﻿using System;
using System.Collections;
using System.Collections.Generic;
using Shanfree.SharpMovie.BLL;
using Shanfree.SharpMovie.Model;

public partial class MasterPage_User : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                // 当前页
                BasePage cntPage = this.Page as BasePage;
                string userID = cntPage.CurrentUser.ID;
                if (cntPage.IsUserLogged == true)
                {
                    UserInfoInitial(userID);
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

    private void UserInfoInitial(string userID)
    {
        UserInfo uInfo = new User().GetUserProfile(userID);
        iUser.ImageUrl = uInfo.Image;
        lbName.Text = uInfo.Name;
        lbTime.Text = uInfo.Time.ToShortDateString();
        lbRemark.Text = uInfo.Remark;
        lbFriend.Text = uInfo.Friends;
        lbFollower.Text = uInfo.Followers;
        lbComment.Text = uInfo.Comments;
        IList<UserInfo> lFollowers = new User().GetFollowerList(userID, 20, 0);
        dlFollowers.DataSource = lFollowers;
        dlFollowers.DataBind();
        IList<UserInfo> lFriend = new User().GetFriendList(userID, 20, 0);
        dlFriends.DataSource = lFriend;
        dlFriends.DataBind();
    }

    protected void lbAll_Click(object sender, EventArgs e)
    {

    }
    protected void lbMine_Click(object sender, EventArgs e)
    {

    }
    protected void lbFriendFav_Click(object sender, EventArgs e)
    {

    }
    protected void lbSignout_Click(object sender, EventArgs e)
    {

    }
    protected void lbName_Click(object sender, EventArgs e)
    {

    }
}
